<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=640,target-densitydpi=device-dpi,maximum-scale=1.0, user-scalable=no">
		<title>result_2</title>
		<link rel="stylesheet" type="text/css" href="../../css/common/common.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/result/result_2.css"/>
	</head>
	<body>
		<!--背景-->
		<div class="beijing">
			<!--能量条-->
			<div class="nengliangtiao">
				<img src="../../img/result/progress_bg.png"/>
			    <div class="nengliang"></div>
			</div>
			<img src="../../img/result/3.png" class="bg3"/>
			<img src="../../img/result/8.png" class="bg8"/>
			<img src="../../img/result/b.png" class="bgb"/>
			<!--评语-->
			<div class="pingyu"><img src="../../img/result/38bg.png"/></div>
			
			<!--音乐-->
			<div class="music"><img src="../../img/result/sound_open_btn.png" class="music_img"/></div>
			
			<!--刷新-->
			<div class="shuaxin">
				<a href="../../index.html"><img src="../../img/result/reload_btn.png" /></a>
			</div>
		</div>
		
		
		<script src="js/jquery-2.1.js"></script>
		<script>
			//自动播放
			var audio = document.createElement('audio');
			audio.src = '../../music/music.mp3';
			audio.autoplay = true;
			document.body.appendChild(audio);
			document.addEventListener('touchstart', function() {
				//增加一个touchstart交互事件，触屏后播放音乐
				audio.play();
				//播放音频后移除touchstart事件的当前匿名函数
				document.removeEventListener('touchstart', arguments.callee, false);
			}, false);

			var beijing = document.getElementsByClassName("beijing")[0];
			var music = beijing.getElementsByClassName("music")[0];
			var music_img = music.getElementsByClassName("music_img")[0];

			music.addEventListener("click", function() {
				var Flag = (music_img.getAttribute("src", 2) == "../../img/result/sound_open_btn.png")
				music_img.src = Flag ? "../../img/result/sound_close_btn.png" : "../../img/result/sound_open_btn.png";

				if(document.body.contains(audio) == true) {
					document.body.removeChild(audio);
				} else {
					document.body.appendChild(audio);
					audio.play();
				}
			})
		</script>
	</body>
</html>
